//
//  MyMainInfoTableViewCell.m
//  OAProject
//
//  Created by yhj on 2017/2/22.
//  Copyright © 2017年 cdnunion. All rights reserved.
//

#import "MyMainInfoTableViewCell.h"

@interface MyMainInfoTableViewCell ()

// 头像
@property(nonatomic,strong)UIImageView *headURL;

// 名字
@property(nonatomic,strong)UILabel *nameLabel;

// 手机号
@property(nonatomic,strong)UILabel *phoneLabel;

@end

@implementation MyMainInfoTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        // ➡️Cell类型
        self.accessoryType=UITableViewCellAccessoryNone;

        self.headURL.hidden=NO;

        _headURL.image=[UIImage imageNamed:@"head"];

        self.nameLabel.font=Font_Number(18);

        self.phoneLabel.font=Font_Number(14);

        self.backgroundColor=WhiteColor;

    }
    return self;
}

// headURL
-(UIImageView *)headURL
{
    if (!_headURL) {
        _headURL=[[UIImageView alloc]init];
        [self.contentView addSubview:_headURL];
        // 圆角和边框
        ViewBorderRadius(_headURL,kmargin*7/2,kmargin/kmargin,ClearColor);

        [_headURL mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.top.mas_equalTo(kmargin*3/2);
            make.size.mas_equalTo(CGSizeMake(kmargin*7,kmargin*7));
        }];
    }
    return _headURL;
}

// nameLabel
- (UILabel *)nameLabel
{

    if (!_nameLabel) {
        _nameLabel=[self getLabelWithText:@"姓名(研发部)" font:Font_Number(18) textColor:[UIColor blackColor] textAlignment:NSTextAlignmentLeft lineBreakMode:NSLineBreakByCharWrapping numberOfLines:1];
        [self.contentView addSubview:_nameLabel];
        [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.headURL.mas_right).offset(kmargin);
            make.top.mas_equalTo(kmargin*2);
        }];
    }
    return _nameLabel;
}

// phoneLabel
- (UILabel *)phoneLabel
{
    if (!_phoneLabel) {
        _phoneLabel=[self getLabelWithText:@"手机:13120568228" font:Font_Number(14) textColor:Color666666 textAlignment:NSTextAlignmentLeft lineBreakMode:NSLineBreakByCharWrapping numberOfLines:1];
        [self.contentView addSubview:_phoneLabel];
        [_phoneLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.headURL.mas_right).offset(kmargin);
            make.top.mas_equalTo(self.nameLabel.mas_bottom).offset(kmargin);
        }];

    }
    return _phoneLabel;
}


@end
